package demoMod.invincibleOne.powers;

import com.megacrit.cardcrawl.core.AbstractCreature;
import com.megacrit.cardcrawl.core.CardCrawlGame;
import com.megacrit.cardcrawl.localization.PowerStrings;
import com.megacrit.cardcrawl.powers.AbstractPower;
import demoMod.invincibleOne.InvincibleOneMod;
import demoMod.invincibleOne.interfaces.OilExplodeHook;

public class EnvironmentalEnergyPower extends AbstractPower implements OilExplodeHook {
    public static final String POWER_ID = InvincibleOneMod.makeID("EnvironmentalEnergyPower");
    private static final PowerStrings powerStrings = CardCrawlGame.languagePack.getPowerStrings(POWER_ID);
    public static final String NAME = powerStrings.NAME;
    public static final String[] DESC = powerStrings.DESCRIPTIONS;

    public EnvironmentalEnergyPower(AbstractCreature owner, int amount) {
        this.owner = owner;
        this.ID = POWER_ID;
        this.name = NAME;
        this.amount = Math.min(amount, 4);
        this.updateDescription();
        loadRegion("painfulStabs");
        this.type = PowerType.DEBUFF;
    }

    @Override
    public void stackPower(int stackAmount) {
        super.stackPower(stackAmount);
        if (this.amount > 4) {
            this.amount = 4;
        }
    }

    @Override
    public void updateDescription() {
        this.description = String.format(DESC[0], this.amount * 25);
    }

    @Override
    public boolean shouldExplode(AbstractCreature target) {
        return true;
    }

    @Override
    public int reduceExplodeAmount(int reduceAmount) {
        return (int) (reduceAmount * (1.0F - amount * 25.0F / 100.0F));
    }

    @Override
    public int modifyExplodeDamage(int damageAmount) {
        return damageAmount;
    }

    @Override
    public int modifyExplodeTriggerAmount(int triggerAmount) {
        return triggerAmount;
    }
}
